I am writing a code to declare a member function of a class as a friend, but I am getting errors. The code is
#include<iostream>
class Vect;
class Coordinate {
float x;
float y;
public:
Coordinate(float a,float b):x(a),y(b){}// constructor
Coordinate():x(0),y(0){};//constructor
display()
{
std::cout<<"\nx:"<<x<<" "<<"y:"<<y;
}
friend Vect::add(Coordinate B);
};
class Vect {
public:
add(Coordinate A)
{
std::cout<<A.x;
}
};
The exact errors are
invalid use of incomplete type 'class Vect'| and forward declaration of 'class Vect'|