no match for operator?

Im getting an error in my main part of my program that i need help with.


10 no match for 'operator<<' in 'std::cout << c'

main code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "LList.h"
#include<iostream>
using namespace std;
int main()
{
    llist<int> i;
    llist<char> c;
    
    i.firstinsert(1);
    i.frontinsert(2);
    i.endinsert(4);
    i.inorderinsert(3);
    
    c.firstinsert('c');
    c.frontinsert('a');
    c.endinsert('r');
    c.inorderinsert('t');
    
    cout<<c<<endl;
    cout<<i<<endl;
    
    
    system("pause");
    return 0;
}


header:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef LList_h_
#define LList_h_
#include <iostream>
using namespace std;
template<class itemtype> 
class llist
{
template<itemtype> 
friend ostream& operator<<(ostream & , llist<itemtype> &);      
      private:     
      struct nodetype
      {
      itemtype item;
      nodetype *next;
      };
      nodetype *first, *last;      
      public:
             llist();
             void firstinsert(itemtype);
             void frontinsert(itemtype);
             void endinsert(itemtype);
             void inorderinsert(itemtype);
             bool search(itemtype);
             bool Delete (itemtype); 
             bool listempty();
             itemtype firstitem();
             itemtype lastitem();
             ~llist();
};
#endif 


implementation:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include "LList.h"
#include<iostream>
template <class itemtype>
llist<itemtype>::llist()
{  
             
   first=last=0;
}
template <class itemtype>
void llist<itemtype>::firstinsert(itemtype x)
{
     first= new nodetype;
     last= first;
     first->item =x;
     first->next = 0;
}
template <class itemtype>
void llist<itemtype>::frontinsert(itemtype x)
{
     nodetype *newnode;
     newnode= new nodetype;
     newnode->item =x;
     newnode->next=first;
     first=newnode;
}
template <class itemtype>
void llist<itemtype>::endinsert(itemtype x)
{
     nodetype *newnode;
     newnode= new nodetype;
     newnode->item =x;
     newnode->next=0;
     last->next=newnode;
     last=newnode;
}
template <class itemtype>
void llist<itemtype>::inorderinsert(itemtype x)
{
     nodetype *cur;
     nodetype *prev;
     
     nodetype *newnode;
     newnode= new nodetype;
     newnode->item =x;
     newnode->next=0;
     if(x<=first->item)
     {
       newnode->next=first;
       first=newnode;
     }
     else if (x>=last->item)
     {
      last->next=newnode;
     last=newnode;
     }
     else
     {
         prev=first;
         cur=first->next;
         while(x>cur->item)
         {
          prev=cur;
          cur=cur->next;
          }
     }
}
template <class itemtype>
bool llist<itemtype>::listempty()
{
return(first==0);
}
template <class itemtype>
itemtype llist<itemtype>::firstitem()
{
return first->item;
}
template <class itemtype>
itemtype llist<itemtype>::lastitem()
{
return last->item;
}
template <class itemtype>
bool llist<itemtype>::search(itemtype x)
{
     nodetype *cur;
     cur=first;
     while ((cur!=0)&&(x!=cur->item))
     {
           cur=cur->next;
     }
     return(cur!=0);
}
template <class itemtype>
llist<itemtype>::~llist()
{
     nodetype *delnode;
     while(first!=0)
     {
       delnode=first;
       first=first->next;
       delete delnode;
     }
}
template <class itemtype>
bool llist<itemtype>::Delete (itemtype x)
{
     nodetype *cur, *prev;
     nodetype *delnode;
     prev=0;
     cur=first;
      while ((cur!=0)&&(x!=cur->item))
     { 
            prev=cur;
            cur=cur->next;
            if(cur==0)
              return 0;
            else
                delnode=cur;
                if(prev==0)
                {   
                    first=first->next;
                }
                else
                {
                prev->next=cur->next;
                if (cur==last)
                   last=prev;
                }
                delete delnode;
                return 1;
     }
}
template <class itemtype> 
ostream& operator<<(ostream &output,llist<itemtype> &l)
{          

        typename llist<itemtype>::nodetype *cur;
        cur=l.first;
        while(cur!=0)
        {
           output<<cur->item<<"|";
           cur=cur->next;
           }
        return output;
}
template class llist<int>;
template class llist<char>;


if anyone can help,i would appreciate it.
Lines 8-9 of the header

 
friend std::ostream& operator<<( std::ostream&, const llist& );


thanks dude
Topic archived. No new replies allowed.