So I have in stockType.h
#include <iostream>
class stockType {
public:
//...
static friend std::ostream& operator<<(std::ostream& out, const stockType& stock);
static friend std::istream& operator>>(std::istream& in, stockType& stock);
private:
//...
}
and in stockType.cpp
std::ostream& operator<<(std::ostream& out, const stockType& stock) {
//...
}
std::istream& operator>>(std::istream& in, stockType& stock) {
//...
}
I'm having no issues with operator<<
but the compiler gives me a fatal error "static function 'std::istream &operator >>(std::istream &,stockType &)' declared but not defined
" and it says it occurs on main.cpp line 32 but there's only 31 lines in main.cpp.