Possible Duplicate:
clean C++ granular friend equivalent? (Answer: Attorney-Client Idiom)
I've wanted this a couple times and haven't been able to come up with a decent way to do it.
Say I've got a member function in class A. I want to be able to call that function from an unrelated class B, but not be generally callable. You might say, "Sure, make the function private and declare B to be a friend of A." That's what I've been doing, but it seems a bit overkill. I don't really want to give B access to everything in A, just the one function.
In short: A::func()
callable only by class B, but B not declared a friend of A. Possible?