CComObject
CComObject is a wrapper which is templatized by your class, e.g.
CComObject<CSimpleObject> *pObj;
If you’re using the object within a function call, use CComObjectStack, which cleans itself up when it goes out of scope.
There are many variations of CComObject, see below.