Const reference and shared_ptr
models two similar, but different concepts.
If you have a const reference, you "know" something, you can inspect this thing (through const methods) but you can't change this thing, and even more important, this thing might vanish any time: you don't own it.
On the other hand, shared_ptr
models a shared ownership. You own the object pointed by the pointer. You can change it and it wont be destructed, unless every owner gets destructed.
Returning const reference to a private member is safe; accepting such a reference is a different thing. You have to make sure the reference remains valid.
shared_ptr
is easier to handle but it's a more expensive solution.
Regarding the exact dynamics, read the manual of shared_ptr