Sorry, you have to overload and copy manually.
If you really, really, are against this, you can use a hack in which you create an abstract parent class with a static counter and an overridden copy constructor, and a child class with your actual data members and an implicit incomplete copy constructor.
You can also use a slightly less hacky approach to the encapsulated class. Save the values ββthat you want to copy in the encapsulated class, and then, when implementing the constructor for explicit instances of the outer class, make a shallow copy of the inner class using its implicit copy constructor.
source share