Hello all. I have what should be a simple problem but I just can't get it to compile. I'm using Dev-C++ 4 on Windows 98. Basically I am creating a Date object and I want to be able to output this object with a line such as:
Code:
Date d();
std::cout << "Date object: " << d << std::endl;
The file Date.h looks like this:
Code:
#ifndef Date_h
#define Date_h

#include <iostream>
#include <string>
#include <ctime>

using namespace std;

class Date
{
public:
	// Constructors
		
private:
	// Variables
	
	// output inserter
	template<class charT, class Traits>
	friend basic_ostream<charT,Traits>&
	operator<<(basic_ostream<charT,Traits>& os, const Date& d);
};

#endif // Date_h
When I try to compile this I get the following errors:
Code:
Date.h:31: ANSI C++ forbids declaration `basic_ostream' with no type
Date.h:31: template-id `basic_ostream<charT, Traits>' used as a declarator
Date.h:31: `basic_ostream' is neither a function nor method; cannot be declared friend
Date.h:31: invalid member template declaration `basic_ostream'
Date.h:31: parse error before `&'
Line 31 is the one that reads
Code:
friend basic_ostream<charT,Traits>&
Any help would be greatly appreciated.