I have a stack class which I am supposed to overload the output operator for. The stack class is templated though, and I am getting some errors with the overloaded output.

Code:
template <class ELEM, int LIST_SIZE = 10>
class Stack {
Code:
template <class T, int N>
ostream & operator<< (ostream &disp, Stack<T, N> &rhs)
{
	Stack<T, N> temp;
	while (!rhs.isEmpty())
	{
		disp << rhs.topValue() << " ";
		temp.push(rhs.pop());
	}

	while (!temp.isEmpty())
		rhs.push(temp.pop());

	return disp;
}
I get linker errors which are very long, but I did some testing and found out that it's because the overloaded operator is templated. If I make two overloaded operator functions, each non-templated but specific to each stack that is used, then it works fine. I've tried changing the template code to
Code:
template <class T, int N = 10>
but you can't use defaults on non-class templates. However, I need to in order to fix the problem. Anyone have any ideas on how to fix this? Is it even possible?