Przeciązenie operatora wyjscia

0
#include <iostream>

using namespace std;

class vector2d{

public:

int x1, x2;
friend ostream& operator<<(ostream& out, vector2d& z);

vector2d( int xx1, int xx2 ){

x1 = xx1;

x2 = xx2;



};
 ostream& operator<<(std::ostream& out,vector2d& z)
{
	out<<""<<vector2d;
	return out;
}

void wyswietl( void ){ cout << x1 << " " << x2 << endl; };

vector2d operator+( vector2d a ){ return vector2d( x1+a.x1, x2+a.x2 ); };


};

int main() {

vector2d x( 3, 1 );

vector2d y( 1, 2 );

x.wyswietl();

y.wyswietl();

vector2d z = x + y;
cout << "wektor z:" << z << endl;


}

Nie działa operator przeciązenia wyjscia nie wiem gdzie jest bład :/ Ktoś pomoże?

1
 friend ostream& operator<<(ostream& out, const vector2d& z)
    return out << z.x1 << ' ' << z.x2;
};
int main()
{
    // vector2d v(args);
    std::cout << v << '\n';
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1