title: operator<< cannot output std::endl -- Fix?
body: <p>The following code gives an error when it's supposed to output just <code>std::endl</code>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  
  struct MyStream {
    std::ostream* out_;
    MyStream(std::ostream* out) : out_(out) {}
    std::ostream&amp; operator&lt;&lt;(const std::string&amp; s) {
      (*out_) &lt;&lt; s;
      return *out_;
    }
  };
  
  template&lt;class OutputStream&gt;
  struct Foo {
    OutputStream* out_;
    Foo(OutputStream* out) : out_(out) {}
    void test() {
      (*out_) &lt;&lt; "OK" &lt;&lt; std::endl;
      (*out_) &lt;&lt; std::endl; // ERROR     
    }
  };
  
  int main(int argc, char** argv){
    MyStream out(&amp;std::cout);
    Foo&lt;MyStream&gt; foo(&amp;out);
    foo.test();
    return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>stream1.cpp:19: error: no match for 'operator&lt;&lt;' in '*((Foo&lt;MyStream&gt;*)this)-&gt;Foo&lt;MyStream&gt;::out_ &lt;&lt; std::endl'
  stream1.cpp:7: note: candidates are: std::ostream&amp; MyStream::operator&lt;&lt;(const std::string&amp;)
  </code></pre>
  
  <p>So it can output a string (see line above the error), but not just the <code>std::endl</code>, presumably because <code>std::endl</code> is not a string, but the <code>operator&lt;&lt;</code> definition asks for a string.</p>
  
  <p>Templating the <code>operator&lt;&lt;</code> didn't help:</p>
  
  <pre><code>  template&lt;class T&gt;
    std::ostream&amp; operator&lt;&lt;(const T&amp; s) { ... }
  </code></pre>
  
  <p>How can I make the code work? Thanks! </p>