1
votes

I am trying to implement overloading my friend stream& operator <<. The problem is I have a private struct Node and I'm not sure how to create a new node when implementing. The error I get is "use of undeclared identifier 'currentPtr'.

this is my .h enter image description here

this is my .cpp enter image description here

All questions here should have all relevant information in the question itself as plain text. Links can stop working at any time making questions meaningless. Code, data, or errors shown as images cannot be copy/pasted; or edited or compiled for further research and investigation. Can you edit this question, removing and replacing all links and images with all relevant information as plain text? All code must meet all requirements of a minimal reproducible example. You'll find many other questions here, with a minimal reproducible example, in plain text. Please use them as an example for how your question should look. - Sam Varshavchik
Either expose a public interface (e.g. iterator) for your list, or create a private member function that performs stream output. The operator can simply invoke that function, since it's already a friend. You can then implement that function in your source file where Node is defined. - paddy