title: Should operator<< be implemented as a friend or as a member function?
body: <p>That's basically the question, is there a "right" way to implement <code>operator&lt;&lt;</code> ?
  Reading <a href="http://bytes.com/forum/thread170304.html" rel="noreferrer">this</a> I can see that something like:</p>
  
  <pre><code>friend bool operator&lt;&lt;(obj const&amp; lhs, obj const&amp; rhs);
  </code></pre>
  
  <p>is preferred to something like </p>
  
  <pre><code>ostream&amp; operator&lt;&lt;(obj const&amp; rhs);
  </code></pre>
  
  <p>But I can't quite see why should I use one or the other.</p>
  
  <p>My personal case is:</p>
  
  <pre><code>friend ostream &amp; operator&lt;&lt;(ostream &amp;os, const Paragraph&amp; p) {
      return os &lt;&lt; p.to_str();
  }
  </code></pre>
  
  <p>But I could probably do:</p>
  
  <pre><code>ostream &amp; operator&lt;&lt;(ostream &amp;os) {
      return os &lt;&lt; paragraph;
  }
  </code></pre>
  
  <p>What rationale should I base this decision on?</p>
  
  <p><em>Note</em>:</p>
  
  <pre><code> Paragraph::to_str = (return paragraph) 
  </code></pre>
  
  <p>where paragraph's a string.</p>