I am trying to add serialization to my DTO objects. I declared the methods in the class as follows outside of the public: and private: tags.

Code:
class DLLEXP DTO
{
	friend std::ostream& operator<<(std::ostream& out, const DTO& obj);
	friend std::ostream& operator>>(std::ostream& in, DTO& obj);
public:
  ......
private:
  ......
};
Then in the .cpp file I have:
Code:
std::ostream& operator<<(std::ostream& output, const DTO& obj)
{
	if(output.good())
	{
		output.write((char*)&obj.id_, sizeof(obj.id_));
	}
	return output;
}
I am getting a compilation error:
error C2248: 'inform::http:ata:TO::id_' : cannot access private member declared in class 'inform::http:ata:TO'
Any hints on the problem. I thought just declaring the methods as friends was enough....

Mike B