#include <iostream>

template<class T>
class static_proxy {
	T m_obj;
	public:
	static_proxy(T obj) : m_obj(obj) {}
	template<class R>
	operator R() { return static_cast<R>(m_obj); }
	
};

/////////////

struct A {
	int m_a;	
	A() : m_a(1) { }
};

struct B: public A {
	int m_b;
	B() : m_b(2) { }
};

/////////////

static_proxy<A*> Get()
{
return static_proxy<A*>( new B );
}

int main()
{
B * b = Get();
std::cout << b->m_b << std::endl;
}