@ Firas has already answered your first question, so I won’t repeat it here.
For your second question, he warns you about this:
friend std::ostream &operator<<(std::ostream &out, const Point<T> &T);
This declaration is in the class template:
template <class T> class Point { // ...
This tells you that even if you can create a Point instance for many different types, you say that the non-tplate operator<< is a friend to everyone. If there is a potentially unlimited set of different types of Point s, you said there is only one operator<< for them.
In fact, this seems to be a mistake in your code - you defined operator<< as a function template, but declared (not a template) function as a friend of the class (one that your code does not seem to define). IOW, this definition:
template <class T> std::ostream &operator<<(std::ostream &out, const Point<T> &T)
... has a template that does not match what you indicated in the friend’s ad above (although I think you intended to match them).
source share