Of course you can be friends with one. Different ideological views, different political views, different religious views, none of these mean that you can't be friends with someone.
The world would be a happier place if we embraced people with different views to our own, rather than try to exclude them and hope that they just go away. People are different, we should embrace and celebrate these differences - life would be very boring if we were all exactly the same.
I would rather be friends with someone who was racist, but otherwise a kind, generous, caring and selfless person, than someone who was not a racist but was a mean, spiteful and vindictive character.
If someone is violently racist, or abuses strangers, that is very different to someone just having racist views. Just as somebody might say they "wanted to murder their ex" - saying these things, thinking these things, is completely different to actually committing such an act.
Also, keep in mind that while racism is not generally accepted at the present time, what is deemed acceptable or unacceptable by a society changes over the years. Racism is out of fashion today, perhaps it will come back? How would you like it to then find yourself shunned due to your own non-racist beliefs? Society changes. Homosexuality was illegal until 1967 (in England and Wales; Scotland until 1980 and Northern Ireland until 1982). Now gay marriage is legal - a huge change in the public mindset in a short period of time.
If you fight discrimination with more discrimination, then you are perpetuating the problem. Fight hatred with love, not more hatred.