COM server/client in C++ Builder 4

Hi,

I'm writing a COM (Automation) server in Borland C++ 4.  I have
successfully managed to pass standard variables between it and a test
client (e.g., a long variable) but I am having trouble passing custom
classes.

I added another Automation object to my Server project using
File->New->ActiveX->Automation Object, etc., and then added a method
to the server COM object that would allow a client to retrieve an
instance of the new object.

Given that the server is called "ObjectTestServer", and the test COM
object is called "MyTestClass" I ended up with the following method in
the server:

STDMETHODIMP TObjectTestServerImpl::getClass(IMyTestClassPtr* Value)
{
  //  my implementation code follows
  //  create an instance of MyTestClass
  TCOMIMyTestClass obj = CoMyTestClass::Create();  // this line
appears to work

  //  now try and pass this back in the Value parameter
  (*Value) = obj;

  //  return a success code
  return S_OK;

Quote
}

However, the code crashes on the "(*Value) = obj".  

I'm quite certain I'm making a fundamental mistake but I have not been
able to find any example code for this sort of thing *anywhere* and
I've been looking full-time (this is a work project) since last week
now.

If anyone can help I'd be MOST grateful, because I'm literally running
out of hair now!

Thanks
mike