class BlockPtr { class Block { friend BlockPtr; protected: char *m_BlockData; char *MakeBlockResident(); Block(); public: char Get(int p_Index); }; protected: Block m_Block; public: Block *operator->(); BlockPtr(); }; BlockPtr::Block::Block() { m_BlockData = 0; } BlockPtr::Block *BlockPtr::operator->() { m_Block.m_BlockData = m_Block.MakeBlockResident(); return &m_Block; } char *BlockPtr::Block::MakeBlockResident() { return new char[1000]; } char BlockPtr::Block::Get(int p_Index) { return m_BlockData[p_Index]; } main() { BlockPtr X; BlockPtr *Y; BlockPtr::Block Z; // illegal; the constructor is protected X->Get(1); // okay; goes through operator-> to Block object Y->Get(1); // won't compile, since BlockPtr doesn't have Get X.Get(1); // won't compile, for the same reason }