Friend function from another namespace

/** module.h */ #pragma once class A { friend void helpers::logValue(const A &); int _val; public: A() {} }; namespace helpers { static void logValue(const A &a) { std::cout << a._val; // <== ERROR: ‘_val’ is not accessible } } How do I declare the friend function in another namespace? >Solution : One possible way… Read More Friend function from another namespace