フレンド関数は、クラスのプライベート メンバーにアクセスできるはずですよね? それで、私はここで何を間違えましたか?.h ファイルに operator<< を含めました。このクラスと仲良くするつもりです。
#include <iostream>
using namespace std;
class fun
{
private:
int a;
int b;
int c;
public:
fun(int a, int b);
void my_swap();
int a_func();
void print();
friend ostream& operator<<(ostream& out, const fun& fun);
};
ostream& operator<<(ostream& out, fun& fun)
{
out << "a= " << fun.a << ", b= " << fun.b << std::endl;
return out;
}