Fix regression introduced in previous commit.

A upcast to class which has a base class deriving from
enable_shared_from_this and is neither the template parameter of
enable_shared_from_this nor the pointee type of a shared_ptr stored
in Lua would fail with a compile time error. The added test should make
the issue clear.