Professors meeting undergrads in social events I know a professor in my university that I was close to when I was an undergrad, not in a academic setting, but in a social setting (church in my case). I did not take his class, but I do know that he is close to many other undergraduates in the social circle, and many of them do take his class. 

While I'm fairly certain that he does not play favoritism, I'm unsure if the professor should withdraw himself from such social circle because he is bound to have his personal friends take his class, and that might be a potential conflict of interest. However, the town is a small college town, and it's unreasonable for him to switch to another social circle (church) since all churches are full of undergrads, and perhaps that is asking for too much.

How should professors behave in this situation? Is it ok for him to be part of a social circle with many undergrads, knowing that some of them may take his class in the future?
It would certainly be unreasonable to expect professors to leave a church because the church also has undergraduates in it.

What you're describing isn't really what's usually called a conflict of interest: the professor doesn't actually stand to gain in any concrete way by giving the student better grades.  What you're concerned about is bias, which is a real, but generally lesser, problem.  It's basically unavoidable to have some potential bias involving students - professors will inevitably end up with students who they know from outside school, or who are identifiably the children of a colleague or administrator or donor, or who we just find ourselves naturally liking (or disliking).

It is the responsibility of a professor to avoid letting this bias turn into favoritism, or even the appearance of favoritism, but the usual approach to this is to have clear standards and try to grade blindly (without knowing whose work we're grading), not to try to eliminate all possible sources of bias.