title: what does undefined reference to operator<<.... means? in c++
body: <p>I have friend function in the class. (in header file. head.h) i have implemented in head.cpp
  and in head.h outside of the class i have ostream&amp; operator&lt;&lt; (ostream&amp; out, TreeNode* ptr);
  i implemented in head.cpp as well. Is there any problem with that?</p>
  
  <p>Header file</p>
  
  <pre><code>friend ostream&amp; operator&lt;&lt; (ostream&amp; out, const TreeDB&amp; ptr);
   ostream&amp; operator&lt;&lt; (ostream&amp; out, TreeNode* ptr);
  </code></pre>
  
  <p>Implementation</p>
  
  <pre><code>ostream&amp; operator&lt;&lt; (ostream&amp; out, TreeNode* ptr)
  {
   if(rhs!=NULL)
   {
    operator&lt;&lt;(out,ptr-&gt;Left());
    out&lt;&lt;(*(ptr-&gt;Entry()));
    operator&lt;&lt;(out,ptr-&gt;Right());
   }
   return out;
  }
  
  
  
  
  ostream&amp; operator&lt;&lt; (ostream&amp; out, const TreeDB&amp; ptr)
  {
   return (operator&lt;&lt;(out,ptr.root));
  }
  </code></pre>
  
  <p>Error: undefined reference to 'operator&lt;&lt;(std::basic_ostream >&amp;,DBentry const&amp;)'</p>
  
  <p>DBentry is another class which manipulates the database entry</p>