These code compile correctly, but instead of A2 *p=dynamic_cast<A2*>(&(*vect[i])); I'd like to have this A2 *p=dynamic_cast<A2*>(vect[i]);
...How can I get this?
vect[i] has the type B::smart. It's not a pointer or a reference. dynamic cast cannot not be applied to an expression of that type. Operator overloads don't come into play.
Look at standard shared pointers: they have a .get() function that returns the raw pointer, which can be dynamic_cast, and shared_ptr even has a special function, std::dynamic_pointer_cast which wraps those steps.