title: Copying a C++ class with a member variable of reference type
body: <p>I've a class which stores a reference to its parent, the reference is passed in the constructor. If I try to copy an instance I get an error "error C2582: 'operator =' function is unavailable" presumably down to the reference being non-assignable.</p>
  
  <p>Is there a way around this, or do I just change the variable to pointer instead of reference?</p>
  
  <p>e.g (over-simplified but I think has the key points):</p>
  
  <pre><code>class MyClass
  {
  public:
   MyClass(OtherClass &amp;parent) : parent(parent) {}
  private:
   OtherClass &amp;parent;
  };
  
  MyClass obj(*this);
  .
  .
  .
  obj = MyClass(*this);
  </code></pre>