I am currently learning about data structures. I haven't had much trouble up until now and I have looked all over the Internet to find why my code is not working but haven't found an answer. The compiler tells me I have an "Undefined reference to 'operator<<(ostream& osObject, listType<int>& const)'" if I take function call out of main everything compiles fine.
definition:
template<class Type>
std::ostream& operator<<(std::ostream& osObject,
const listType<Type>& list)
{
listType<Type>* current; //pointer to traverse list
current = list.first; //set pointer to first node
while(current != NULL) //iterate through the list
{
osObject << current->info << " "; //send info to screen
current = current->link; //on to the next one
}