title: C++ Accessing a private member in a friend class
body: <p>I have 2 classes (firstClass and secondClass) which firstClass is a friend of secondClass, and has a private nested unordered_map, which I want to access it in a function of secondClass. 
  So basically the code is like this:</p>
  
  <pre><code>    class secondClass;
      typedef unordered_map STable&lt;unsigned, unordered_map&lt;unsigned, double&gt; &gt; NESTED_MAP;
  
  
          class firstClass{
          friend class secondClass;
          void myfunc1(secondClass* sc){
              sc-&gt;myfunc2(&amp;STable);
          }
          private:
              NESTED_MAP STable;
          };
  
  
          class secondClass{
          public:
              void myfunc2(NESTED_MAP* st){
              //Here I want to insert some elements in STable.
              //Something like:
              st[1][2]=0.5;
              }
          };
      int main(){
              firstClass  fco;
              secondClass sco;
              fco.myfunc1(&amp;sco);
              return 0;
  
          }
  </code></pre>
  
  <p>I know that it should be trivial, but I don't know how to solve it.
  Any idea? (I changed the code and the question to make it more clear)</p>