title: friend with class but can't access private members
body: <p>Friend functions should be able to access a class private members right?
  So what have I done wrong here? I've included my .h file with the operator&lt;&lt; I intent to befriend with the class.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  class fun
  {
  private:
      int a;
      int b;
      int c;
  
  
  public:
      fun(int a, int b);
      void my_swap();
      int a_func();
      void print();
  
      friend ostream&amp; operator&lt;&lt;(ostream&amp; out, const fun&amp; fun);
  };
  
  ostream&amp; operator&lt;&lt;(ostream&amp; out, fun&amp; fun)
  {
      out &lt;&lt; "a= " &lt;&lt; fun.a &lt;&lt; ", b= " &lt;&lt; fun.b &lt;&lt; std::endl;
  
      return out;
  }
  </code></pre>