I am writing unit tests for undergraduate students and want to enforce certain members as public or private. I am aware of methods to actually test private members, e.g., #define private public or using a friend class, but have not seen anything that would allow me to check exactly if a member is private or not.
A brute force method would be trying a compile and parsing the output error, e.g., look for something like error: 'foo' is a private member of 'Bar', but I am hoping someone will have a better trick!