title: error: 'member' is private within this context - namespace
body: <p>I have a class within a namespace like following.
  <strong>test.h</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  using std::cout;
  namespace n1
  {
      class myClass;
  }
  
  class n1::myClass
  {
  public:
      myClass(int na, int nb):a(na), b(nb){}
  private:
      int a;
      int b;
  friend std::ostream&amp; operator &lt;&lt; (std::ostream &amp; stream, const n1::myClass&amp; cls);
  };
  </code></pre>
  
  <p><strong>test.cpp</strong></p>
  
  <pre><code>#include "test.h"
  std::ostream&amp; operator &lt;&lt; (std::ostream &amp; str, const n1::myClass&amp; cls)
  {
      str &lt;&lt; cls.a &lt;&lt; " " &lt;&lt; cls.b &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>On Compilation, I am getting following error. </p>
  
  <pre><code>test.h: In function ‘std::ostream&amp; operator&lt;&lt;(std::ostream&amp;, const n1::myClass&amp;)’:
  test.h:13:6: error: ‘int n1::myClass::a’ is private
  test.cpp:5:13: error: within this context
  test.h:14:6: error: ‘int n1::myClass::b’ is private
  test.cpp:5:29: error: within this context
  </code></pre>
  
  <p>How do I get past the errors?</p>