a4.cpp:47: warning: friend declaration `Vector<T> operator+(const Vector<T>&, const Vector<T>&)' declares a non-template function
a4.cpp:47: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning
when trying to add this non member function as a friend
a declaration of a template begins with the word template. You can either put the whole function body in (making a separate nontemplate friend for each T) or forward declare a template and friend its full specializations.
why is your operator+ a friend anyway? implement operator+= and then just return vec1+=vec2; from your nonmember nonfriend operator+