Very often it depends on context.
Some people (like me) make the distinction between meine Freundin (my girlfriend) and eine Freundin von mir (a female friend), i.e. use the difference between genitive case and genitive in form of von plus dative, but again, not everyone does.
(The equivalent for boyfriend / male friend would be mein Freund / ein Freund von mir.)
The word "Freund" is masculine. Der only turns to den when in the accusative position. Even though it may seem like der Freund is the direct object in this sentence, the fact that a conjugation of the verb "sein" is present makes it act like the subject of the sentence.
"Er ist mein Freund" "Er hat meinen Freund" (Kidnapping case vielleicht? xD)