title: Default assignment operator in inner class with reference members
body: <p>I've run into an issue I don't understand and I was hoping someone here might provide some insight. The simplified code is as follows (original code was a custom queue/queue-iterator implementation):</p>
  
  <pre><code>class B
  {
  public:
      B() {};
      class C
      {
      public:
          int get();
          C(B&amp;b) : b(b){};
      private:
          B&amp; b;
      };
  public:
      C get_c() { return C(*this); }
  };
  
  int main()
  {
      B b;
      B::C c = b.get_c();
  
  
      c = b.get_c();
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>This, when compiled, gives me the following error:</p>
  
  <pre><code>foo.cpp: In member function 'B::C&amp; B::C::operator=(const B::C&amp;)':
  foo.cpp:46: error: non-static reference member 'B&amp; B::C::b', can't use default assignment operator
  foo.cpp: In function 'int main()':
  foo.cpp:63: note: synthesized method 'B::C&amp; B::C::operator=(const B::C&amp;)' first required here
  </code></pre>
  
  <p>I can go around this by using two separate C variables, as they are supposed to be independent 'C' objects, but this only hides the problem (I still don't understand why I can't do this).</p>
  
  <p>I think the reason is that the reference cannot be copied, but I don't understand why. Do I need to provide my own assignment operator and copy constructor?</p>