If your function f is a factory method, it is better to return a pointer, or an initialized smart pointer object such as auto_ptr.
auto_ptr
To use:
{
auto_ptr myObjPtr = f();
//use myObjPtr . . .
} // the new Object is deleted when myObjPtr goes out of scope