I'm having trouble creating the overload function of "<<" for my doubly linked list.
Here is my header file:
#ifndef SORTEDLIST_H
#define SORTEDLIST_H
#include <iostream>
class SortedList {
private:
    typedef struct node {
        int data;
        node* next;
        node* prev;
    }*nodePtr;
    int theSize;
    nodePtr head;
    nodePtr tail;
public:
    SortedList();
    //~SortedList();
    void insertItem(int inData);
    bool deleteItem(int delData);
    friend ostream& operator <<(ostream& ot, const SortedList& sL);
    int size() const;
    bool empty() const;
};
#endif
Here is my constructor:
SortedList::SortedList() {
    //Set pointers equal to NULL
    head = NULL;
    tail = NULL;
    theSize = 0;
    head = new node; //create new node of 3 parts: head, data and prev
    tail = new node; //create new node of 3 parts: head, data and prev
    head->next = tail; //next partition points to tail
    head->prev = NULL; //not necessary to put in?
    tail->prev = head; //prev partition points to head
    tail->next = NULL; //not necessary to put in?
    /*temp->next = tail; //access the node the temp pointer is pointing to, set the 'next' part equal to tail*/
}
and here is the ostream overload function I can't get to work:
ostream& operator<<(ostream& ot, const SortedList& sL)
{
    sL.nodePtr temp;
    temp = sL.head->next;
    while (temp != sL.tail) {
        ot << temp->data << " ";
        temp = temp->next;
    }
    ot << "\n";
}
It keeps telling me sL.NodePtr, sL.head, sL.tail are inaccessible. I do have it set as friend function so I am unsure why.
 
     
    