Consider this code:
struct A
{
void foo() const
{
std::cout << \"const\" << std::endl;
}
private:
void foo()
Access specifiers do not affect name-lookup and function-call resolution, ever. The function is selected before the compiler checks whether the call should trigger an access violation.
This way, if you change an access specifier, you'll be alerted at compile-time if there is a violation in existing code; if privacy were taken into account for function call resolution, your program's behavior could silently change.