title: How to call a friend operator overload function?
body: <pre><code>class Sale
  {
     void Display();
  </code></pre>
  
  <p>I can call it in another file, let say register.cpp file as </p>
  
  <pre><code>something.Display();
  </code></pre>
  
  <p>How can I call Display() if were a friend operator&lt;&lt; function?</p>
  
  <pre><code>class Sale
  {
    friend ostream&amp; operator&lt;&lt;(ostream&amp; os, const Song&amp; s);
  </code></pre>
  
  <p>here is sale.cpp with ostream definition</p>
  
  <pre><code>ostream&amp; operator&lt;&lt;(ostream &amp; os, const Song&amp; s)
  { //title, artist, category, and size are private member data of sale.h
      os &lt;&lt; s.title &lt;&lt; "\t" &lt;&lt; s.artist
         &lt;&lt; "\t" &lt;&lt; s.category &lt;&lt; "\t" &lt;&lt; s.size;
  }
  </code></pre>
  
  <p>Display() definition is hard-coded to cout </p>
  
  <p>My assignment also requires me to call the operator&lt;&lt; in register.cpp file
  to do the same thing as Display()</p>
  
  <p>How can I do it?</p>