I used only the methods and properties of a friend to use inside the class itself to clone or assign another object to myself. This has been largely replaced, we reorganized the design to implement the Memento Design template in our design.
Memento is created by the same mechanisms that are used to save and load the object. that is, Memento creates a stream, an object writes to it, and memory can be transferred to any other object of the same class to make it an exact duplicate of the object that creates the memory.
Sometimes there are cases when objects should work very close to each other, and in this case I simplify their interaction by combining them behind another object. Variables that are "friendly" variables and are visible only to other objects are private to the class that performs the aggregation.
source share