Is this design bad? Does it break encapsulation? The structure class B is a component of class A. Therefore, class A needs access to class B's members. Let a house be class A. Let a housekeeper be a component of class A. Let a room be class B. A room, and therefore class B, is a component of class A.A housekeeper needs access to room's members to switch bedroom_dirty = true to bedroom_dirty = false, for example. A housekeeper does not belong in a room (i.e. class B); that would be a roomkeeper, and we are not talking about that.Is this design bad?class A{  class B  {     friend class A{}; // A has access to all of B's members  };};
Inner and outer class relationship: should outer class be friend of inner's?
design;c++;object oriented design;encapsulation;friends