The functionality can be achieved by making the constructor private. You will still need a static function to get the heap allocated handle. This is how i usually do it (the same behavior you asked for)
this is not complete code, just half baked solution to show you the direction.
using namespace std;
static A* CreateAndGetInstancePointer()
return new A();
int _tmain(int argc, _TCHAR* argv)
A *pa = A::CreateAndGetInstancePointer();
cout << pa->test();