Q:

No match for 'operator <<'? 

I wrote a program that uses structures and allows the user to enter a point and then output the point, but when I run the program it is giving me the error: main.cpp:19:10: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream}’ and ‘Point’)
     cout << result;
What does it mean? 
#include <iostream>
using namespace std;

struct Point {
    double x, y;
};

// get a point from user input
Point input_point() {
    double x, y;
    cin >> x >> y;
    Point p = {x, y};
    return p;
}

int main() {
    Point result;
    result = input_point();
    cout << result;
}

A:

You could overload the operator like this:
std::ostream& operator<< (std::ostream& stream, const Point& p) {
     stream << "[" << p.x << ", " << p.y << "]";
     return stream;
}

And your result will be something like this:
[1, 2]

Basically, your overloaded function should take a reference the stream and your object, and then it has to implement the logic to print the object (such as by printing its members) and then it should return the reference to the stream again. 

Here's the modified program that shows where to insert the function:
#include <iostream>
using namespace std;
struct Point {
    double x, y;
};

 std::ostream& operator<< (std::ostream& stream,  const Point& p) {
     stream << "[" << p.x << ", " << p.y << "]";
     return stream;
}
// get a point from user input
Point input_point() {
    double x, y;
    cin >> x >> y;
    Point p = { x, y };
    return p;
}

int main() {
    Point result;
    result = input_point();
    cout << result;
}

