class IX : public IUnknown { virtual HRESULT __stdcall X1() = 0; }; class CInnerCOMObj : public IX { private: ULONG m_refcnt; IUnknown *m_pOuterUnk; //Holds the outer objects IUnknown HRESULT QueryInterface(REFIID riid, VOID **ppv) { return m_pOuterUnk->QueryInterface(riid, ppv); } HRESULT AddRef() { return m_pOuterUnk->AddRef(); } HRESULT Release() { return m_pOuterUnk->Release(); } HRESULT X1() { ... } /* Assume the IClassFactory::CreateInstance passes in the outer object's IUnknown */ CInnerCOMObj(IUnknown *pOuter) : m_refcnt(0), m_pOuterUnk(NULL) { m_pOuterUnk = pOuter; } };