I don't think so.
One declares a non-template global function that is a "friend" of the template
class and the other defines a global function template - that is not a friend of
the template class (14.5.3-1).
I was kind of in a rush when I posted the correction.. you could actually just
change the friend declaration like:
template <class T> friend T getitem(const vector<T>& vref, int j);
and leave everything else the same.
Richard

Thank you Richard Grant. Your idea does fix all my template friend
problems.
The language standard seems to hold open the possibility that a
non-template function could be a friend of all classes derived from a
template class. I am unable to devise an example of this. Such a
friend function could not take any arguments pointing to an instance of
the class or refer to any static class members so what is the point of
making it a friend? Even trying to bring an enum declared in the class
scope into the friend function scope does not work with Digital Mars
C++. Is the standard illogical or am I overlooking something?
Steve Strand

The language standard seems to hold open the possibility that a
non-template function could be a friend of all classes derived from a
template class. I am unable to devise an example of this. Such a
friend function could not take any arguments pointing to an instance of
the class or refer to any static class members so what is the point of
making it a friend?

Actually, I think it says that you can do like:
friend T getitem(const vector<T>& vref, int j);
And that for each specialization of the class template vector, there can be
defined a getitem function that will be a friend to the specialization, but then
you must define the function to match the template specialization like:
int getitem(const vector<int>& vref, int j) { return 0; }
But since I have not had the opportunity to use specializations in this context,
I'll need to check on that.

Even trying to bring an enum declared in the class
scope into the friend function scope does not work with Digital Mars
C++. Is the standard illogical or am I overlooking something?

I don't think so.
One declares a non-template global function that is a "friend" of the template
class and the other defines a global function template - that is not a friend
of
the template class (14.5.3-1).
I was kind of in a rush when I posted the correction.. you could actually just
change the friend declaration like:
template <class T> friend T getitem(const vector<T>& vref, int j);
and leave everything else the same.
Richard

Richard & Walter,
I know you are not in the business of worrying about other compilers, but I
tried this program on g++ (mingw) and Borland, and
neither of them would compile it. dmc does.
Executing g++.exe...
./* .... clip ...*/
C:/Dev-Cpp/Worktemp/template.cpp:9: declaration of `class T'
C:/Dev-Cpp/Worktemp/template.cpp:4: shadows template parm `class T'
Execution terminated
Borland bcc32 says this: