Error: Friends must be functions or classes

This is a discussion on Error: Friends must be functions or classes within the C++ Programming forums, part of the General Programming Boards category; I have inherited some code which supposedly compiled with Borland C++ Builder 1.0. However, the following line: friend istream &operator>>(istream ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    3

    Error: Friends must be functions or classes

    I have inherited some code which supposedly compiled with Borland C++ Builder 1.0. However, the following line:

    friend istream &operator>>(istream &stream, mol &ob);

    gives the error: Friends must be functions or classes

    Why istream is not being found as a class beats me.

    Anybody have any ideas?

    Thanks

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Make sure its in the current namespace. Looks like its having trouble with the 'operator>>' part by the error message. What compiler are you using now?
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of classes?
    By dream_noir in forum C++ Programming
    Replies: 2
    Last Post: 03-22-2009, 12:43 PM
  2. Replies: 7
    Last Post: 11-17-2008, 01:00 PM
  3. Classes and member functions
    By uraliss in forum C++ Programming
    Replies: 2
    Last Post: 04-13-2006, 08:38 AM
  4. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-24-2004, 12:22 AM
  5. API "Clean Up" Functions & delete Pointers :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-10-2002, 07:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21