title: C++ passing a nested unordered_map by reference and manipulating it
body: <p>I have 2 classes (<code>firstClass</code> and <code>secondClass</code>) of which <code>firstClass</code> is a friend of <code>secondClass</code>, and has a private nested <code>std::unordered_map</code>, which I want to access it in a function of <code>secondClass</code>.</p>
  
  <p>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>The point is that if instead of the nested map, I use a simple <code>std::unordered_map</code>, I can easily modify it (add new elements, or change the values of some keys). But, in the nested map I can not do anything.</p>
  
  <p>I know that it should be trivial, but I don't know how to solve it.
  Any idea?</p>