【C++】友元
这里贴一篇讲得很好的
https://blog.csdn.net/weixin_46098577/article/details/116596183?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166208444616781683987803%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=166208444616781683987803&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-1-116596183-null-null.142^v44^new_blog_pos_by_title&utm_term=%E5%8F%8B%E5%85%83&spm=1018.2226.3001.4187
要点:
1、全局函数声明为友元
2、友元类
3、友元成员函数
4、友元的作用就是访问私有资源