Declaring a namespace as a friend of a class
No, it’s not possible befriend a namespace. If nothing else, it would constitute a “security breach,” as namespaces can be extended anywhere. So anyone could add an arbitrary function to the namespace and access the class’s non-public data. The closest you can get is the solution you propose, making those functions static members of a … Read more