次の宣言があります。
friend ostream& operator<<(ostream&,const List&);
そして、私は次の定義を持っています:
ostream& operator<<(ostream& out,const List& item) {
vector<List::Employee>::const_iterator It;
for (It=item.employees.begin();It!=item.employees.end();It++) {}
}
Employee は私自身の構造体であり、employees はクラス List の Employee のプライベート ベクトルです。コンパイラは私に次のエラーを与えます:
std::vector<List::Employee,std::allocator<List::Employee>> List::employees is private
それを解決する方法はありますか?