In The Adventures of Huckleberry Finn, how is it shown that Huck feels that Jim is his friend, but still accepts society's views towards slaves?
In Chapter 31, Huck knows that the societally acceptable thing to do is to tell the proper authorities about Jim's location, so he can be returned to his legal place in society. However, he has grown close to Jim through their adventures, and feels conflicted. On the one hand, he wants to "do the right thing," and according to society, the right thing it to not let a slave escape. On the other hand, he wants Jim to be safe and happy, since they are friends and he remembers how Jim has helped him so many times.
Once I said to myself it would be a thousand times better for Jim to be a slave at home where his family was, as long as he'd GOT to be a slave, and so I'd better write a letter to Tom Sawyer and tell him to tell Miss Watson where he was.
(Twain, The Adventures of Huckleberry Finn, gutenberg.org)
This shows how Huck has the typical view towards slaves of the time; he is more concerned with Jim's social place in terms of slavery. Since Huck doesn't know that Jim is free, he assumes that Jim will be enslaved no matter what he does, and so it is better to be among his own family instead of a strange place. However, he soon recalls Jim's loyalty and friendship, and resolves to steal him away, regardless of the consequence; Huck wants Jim to be free even if it means that he himself will be morally punished.