I have two classes (Date and Student) linked and 've been trying to overload << for each, but never been successful
Code:
//*******************************
//   Date.cpp
//******************************
#include "Date.h"
.
.
.
ofstream &operator<<(ofstream& stream, const Date& d){
	stream << d.getMonth() << '|'
		   << d.getDay() << '|'
		   << d.getYear() << '|';

	return stream;
}
.
.
.
I include "Date.h" in "Student.h"
The error is pointed to Student.cpp
Code:
//****************************
//   Student.cpp
//****************************
#include "Student.h"
.
.
ofstream &operator<<(ofstream& stream, const Student& s) {
	stream << s.getFirstName() << '|'
		<< s.getMiddleName() << '|'
		<< s.getLastName() << '|'
		<< s.getAddress1() << '|'
		<< s.getAddress2() << '|'
		<< s.getCity() << '|'
		<< s.getState() << '|'
		<< s.getZipCode() << '|'
		<< s.getEnrollDate() << '|'    // error
		<< s.getCreditHours() << '|';
	return stream;
}
.
.
Here's the error
E:\jDocument\CSCI\231\no1\Student.cpp(354) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'const class Date' (or there is no acceptable conversion)
Again, I don't know if the problem lies above or somewhere else on my codes. I'll upload the whole file if necessary.
thnx