У меня есть такая декларация
#include "Output/PtPathWriter.h"
// class PtPathWriter // I've also tried forward declaring the friend class
// leg data is a class designed to hold data for a single leg.
class PtPathLeg
{
friend class PtPathWriter; // doesn't work
//friend void PTPathWriter::writeToFile(string fileName, PtPath* path); // works
protected:
vector<map<int, shared_ptr<BoardingStopAlternative>>> m_boarding_stop_alternatives;
// some other stuff
}
Однако я получаю сообщение об ошибке от PtPathWriter:
PtPathWriter.cpp(44): error #308: member "PtPathLeg::m_boarding_stop_alternatives" (declared at line 79 of "../include/Paths/PtPathLeg.h") is inaccessible
1> path->m_leg_data.at(legnr).m_boarding_stop_alternatives.at(stopId);
Интересно, если я использую объявление альтернативного друга (которое явно указывает метод), оно работает? Есть мысли о том, почему они разные?
Использование Intel C ++ Compiler 11.1.065, кстати.