Declaring a Friendly Class for Sharing

Is there a way to declare a given class a as a friendly user of class b, therefore allowing methods of class a to access any private or protected methods and properties of class b?

you mean make a Class B that is a SUBCLASS of Class A?
if so, then yes, that is one of the main tenets of OOP

read the documentation about Sub and Super Classes

There is not “friend” scope in Xjo

But what you CAN do is

  1. take your class (call it A) & put it in a module
  2. declare a PRIVATE class interface that class A implements - note that you CAN implement an interface with private methods
  3. now anything in this module that needs to use class A can cast it to the private interface & access whatever you exposed in that interface - this WILL only be methods but since you can make method pairs act like a getter/setter things should be fine

So you have classes in that module that can be “friends” but nothing outside can be
It’s not exactly “friend” from C++ but its about as close as you can get

Very clever. That’s the kind of trick I was hoping for.