template<typename TType> TType unsafe_cast(CAnyTypeWrapper &obj) { return *((TType*)((CAnyType<TType>*)obj.object->get())); }
To allow access to object you'd have to make it a friend function of CAnyTypeWrapper. A call would look like that:
CAnyTypeWrapper any(5);int i = unsafe_cast<int>(any);