I went through this over the past year (my freshman year in college). Most of my classes were small (~30 students) in comparison to the average first-year class at most colleges, and they were in a variety of subjects, two in my majors, and two outside my majors. I was already developing separate friend groups, but I still wanted to get to know people in my classes, especially those who will be studying the same subjects as me down the line. The takeaway from my year of friend-seeking was this:
It's easier to find friends who like what you like. Learn it together.
Take, for instance, my introductory physics course first semester (special relativity and some intro quantum mechanics). Two thirds of the class reacted like this:
This is so freaking awesome! It's almost always non-intuitive but it works out and the implications are so cool!
The last third of the class reacted like this:
This is so freaking boring.
I was in the first group, and let me tell you, we loved to talk about the class, the ideas we discussed there, and how it all fit into physics as a whole. I can't count how many discussions spontaneously started later on around a random topic we had briefly mentioned in class. They went places I couldn't have foreseen them going.
#1: Don't study alone.
I do mean this. You're likely studying things that are more intuitive than special relativity. But you're going to run into problems along the way. Some you can solve yourself; some you'll have to go to a professor or a TA to get answers to. But a fellow student, someone who's learning things just the way you are, might understand your difficulties even better.
Obviously, it's going to be less convenient for you to go to study sessions. I had the same problem for one on Thursday night, which required me to have dinner later (9:00!). But I found that each time, someone caught one or two mistakes that I would have otherwise made.
Point is, go to a study session as often as you can. You don't have to do it regularly, but just once in a while.
#2: Get to know your classmates in the study group.
If the class is something in your major, then these classmates might also be your classmates in future classes. You'll need them for help, and they'll need you. Start building working relationships with them, where you understand each others' strengths and weaknesses. College is hell at times; don't go it alone.
#3: Build on this.
If you go to some of these sessions and get to know these people, you're in prime position to start a friendship. I've gotten to know plenty of people for long-term projects, and there are almost always moments along the way - shared experiences, for instance - that lead to bonding. I think there's a good chance you'll find yourself unconsciously transitioning into a friendship regardless of whether you choose to or not.
If you want to make a conscious effort, that's fine! Again, you have some central experiences, which are almost always a basic talking point. You know the people to some degree; that's not insignificant. If you want to hang out socially, do that! It's easy. Start with something like
Hey, after we finish, do you want to go to the dining hall and get some food? I hear there's a specialty salad bar tonight.
You could also use
We've been talking about game theory a bit in class. Has anyone here seen A Beautiful Mind?
I basically used the above method to make some of my earliest friends last autumn. It helped that some of us interacted in other areas (e.g. sports), but I was still able to get to know people socially. Physics is cool (in our opinions), and by learning it together, we created some pretty strong bonds.