how to use a friend function in cpp file? : > i have a header file and cpp file .. in the h file i declared an AA
> class and added some private parameters and declared a friend function
> but when i try to access the private parametrs an the cpp file a get
> an error "within this context" and i get also in the heder file this error with the private parametrs : 'std::__cxx11::string x::y::ZZZ::ZZZ_name' is private

    #include <iostream>
    #include <string>
    using std::string;
    
    namespace X{
    namespace Y{
    
        class ZZZ{
        private:
            string ZZZ_name;
     
    
        public:
    friend std::ostream &
                operator<<(std::ostream &output, const ZZZ &zzz);
    };
    
            std::ostream &operator<<(std::ostream &output, const ZZZ &zzz;
    }}
    
    
    // ZZZ.cpp
    //and this is what i have in cpp file :
    #include "ZZZ.h"
    #include <stdbool.h>
    
    using namespace x::y;
    using std::cout;
    
    std::ostream& operator<<(std::ostream& output, const ZZZ& zzz){
    	output << zzz.ZZZ_name << "." ;
    	return output;
    }

