title: Overloading C++ Insertion Operator (<<) for a class
body: <p>I'm trying to write a class that overloads the insertion operator but in my header file I get the error.</p>
  
  <pre><code>Overloaded 'operator&lt;&lt;' must be a binary operator (has 3 parameters)
  </code></pre>
  
  <p>Here is my code:</p>
  
  <p>.h file</p>
  
  <pre><code>ostream &amp; operator&lt;&lt;(ostream &amp; os, Domino dom);
  </code></pre>
  
  <p>.cpp file</p>
  
  <pre><code>ostream &amp; operator&lt;&lt; (ostream &amp; os, Domino dom) {
      return os &lt;&lt; dom.toString();
  }
  </code></pre>
  
  <p>I'm following a text book and this is what they use as an example but its not working for me.. Any suggestions?</p>