You cannot return a pointer to a local stack object. Your compiler should have issued a warning. Once the function is done, the object on the stack will lose scope, be destroyed and your pointer is invalid.
You need to put your variable on the heap by creating it with new
or you need to make a copy (although I'm not sure if the class is copyable).