title: Overload of operator<< with basic_ostream
body: <p>Why the typical header of stream manipulation with a user-defined class <code>C</code> is typically like this:</p>
  
  <pre><code>std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const C&amp; c);
  std::istream&amp; operator&gt;&gt;(std::istream&amp; is, C&amp;);
  </code></pre>
  
  <p>and not like this:</p>
  
  <pre><code>template &lt;class CharT, class Traits&gt; 
  std::basic_ostream&lt;CharT, Traits&gt;&amp; operator&lt;&lt;(
          std::basic_ostream&lt;CharT, Traits&gt;&amp; os
          const C&amp; c);
  
  template &lt;class CharT, class Traits&gt; 
  std::basic_istream&lt;CharT, Traits&gt;&amp; operator&gt;&gt;(
          std::basic_istream&lt;CharT, Traits&gt;&amp; is
          C&amp; c);
  </code></pre>
  
  <p>My question is why the usual overloading of stream operators is done with <code>std::ostream</code>, which is a typedef for <code>char</code> of <code>std::basic_ostream</code>, and why it is not done directly with <code>std::basic_ostream</code> ?</p>
  
  <p>For example:</p>
  
  <pre><code>class C
  {
      ...
  };
  
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const C&amp; c)
  {
      ...
  }
  
  int main()
  {
      C c;
      std::wofstream myFile("myFile.txt");
      myFile &lt;&lt; c; //Impossible
  }
  </code></pre>
  
  <p>The <code>operator&lt;&lt;</code> written here limit us to use only stream object that are specialized for <code>char</code> (<code>std::ostream</code>, <code>std::ostringstream</code>, ...).
  So if using <code>std::ostream</code> is more limiting than <code>std::basic_ostream</code>,
  why <code>std::basic_ostream</code> is never mentioned when talking about stream operators overloading?</p>