When I think of this issue, two solutions come to mind: change your situation, or change your perspective (or both, of course)
If I'm not wrong, the loneliness sounds like it stems from being, well, alone. You want to be around other people who listen and care, but currently that's not the situation, right? And to that the first approach would be to change that.
This is something to consider:
While you may have problems finding friendship in your class, im sure your not the only person in your school that feels that way. See if you can spot anyone else in school thats also lonely like you. Maybe someone on their own at lunchtimes whos also not displaying confidence. Start a conversation with them. Who knows you may find a friend.
Go out and actively try to make friends. Joins groups and clubs, say hello to people you don't know, and actively
care and show interest in what they have to say and their thoughts. It's something you want, and it's something other people want to. If you give them you attention and interest, they may want to talk to you more. I think people like to be listened to and cared about, and doing that and making people feel important and happy, will make them want to come back.
If you're like I was in school, with that seeming like a very daunting task, near terrifying, there's also this approach.
http://www.youtube.com/watch?v=k7X7sZzSXYs
There's nothing wrong with being alone, it doesn't have to be lonely. It can be peaceful, it can be calming. The one in the video sums it all up pretty well I think, just that embracing and enjoying the alone can be great, just as being with people can be.
My two cents, hope it helped!