title: About std::ostream constructor
body: <p>I want to use <code>std::ostream</code> like this:</p>
  
  <pre><code>int main()
  {
      std::ostream os;
      os &lt;&lt; "something ..." &lt;&lt; std::endl;
      return 0;
  }
  </code></pre>
  
  <p>There's an error said that the ostream constructor is protected:</p>
  
  <blockquote>
    <p>error: ‘std::basic_ostream&lt;_CharT, _Traits>::basic_ostream() [with _CharT = char; _Traits = std::char_traits]’ is protected.</p>
  </blockquote>
  
  <p>But I remember <code>operator&lt;&lt;</code> could be overloaded like this:</p>
  
  <pre><code>// In a class. 
  friend std::ostream &amp; operator&lt;&lt;(std::ostream&amp; out, const String &amp; s) {
      out &lt;&lt; s.m_s;
      return out;
  }
  </code></pre>
  
  <p>Any advice on why my code doesn't work?</p>