How can I remove/refactor a «friend» dependency declaration properly?
问题 The background of this question is based on a practical sample where I wanted to remove a «friend» dependency from a pair of classes that are used to manage read/write locked access to a shared resource. Here's an abstraction of the original structural design for that scenario: Marked in red, there's this ugly «friend» dependency I want to remove from the design. In short, why do I have this thing there: ClassAProvider shares a reference to a ClassA over a number of concurrently accessing