I am implementing my own SharedPtr and WeakPtr and there are many methods where I need access to private members of SharedPtr from WeakPtr's methods. For example:
template<typename Resource>
WeakPtr<Resource>::WeakPtr(const SharedPtr<Resource>& rhs)
{
//how can i get access to private members of rhs there?
//only way is make them public?
//I need something like this:
resource = rhs.resource;
control_block = rhs.control_block;
}