TITLE: privately scoped enums (Newsgroups: comp.lang.c++.moderated) PROBLEM: "Christopher S. Kush" class Gunk { public: private: enum StateFlag { hosed, jolly, pensive, irked }; struct GorpRecord { StateFlag sf; }; }; "(S) private member "Gunk::StateFlag" cannot be accessed." I've tried making GorpRecord a class, I've tried friendship between Gunk and GorpRecord in both directions. I want an enum that only Gunk and GorpRecord know about. I don't want to make the enum public. RESPONSE: stephen.clamage@eng.sun.com, 20 Aug 96 Declaring a member class to be a friend is a little tricky. You can do it this way: class Gunk { public: private: enum StateFlag { hosed, jolly, pensive, irked }; struct GorpRecord; // forward declare the member class friend GorpRecord; // make the member class a friend struct GorpRecord { // define the member class StateFlag sf; }; }; If you omit the forward declaration and just say "friend struct GorpRecord", it would refer to some global struct GorpRecord, not a member one. There are other ways to get similar effects, but if you really don't want ANY other class to know about the enum, this solution will work.