I have a class hierarchy as follows:
class BaseSession : public boost::enable_shared_from_this class DerivedSessionA : public BaseSession
Simply get the stored pointer using the std::unique_ptr<>::get() method:
std::unique_ptr<>::get()
Func(dynamic_cast(shared_from_this().get()))
that if shared_from_this() has that prototype:
shared_from_this()
std::unique_ptr& shared_from_this();