Let\'s say I have the following class X where I want to return access to an internal member:
class X
class Z { // details }; class X { std::vec
To add to the solution jwfearn and kevin provided, here's the corresponding solution when the function returns shared_ptr:
struct C { shared_ptr get() const { return c; } shared_ptr get() { return const_pointer_cast(static_cast(*this).get()); } shared_ptr c; };