"Meu" or "O meu"
"My xx" is sometimes translated to "O meu/A minha" and sometimes to "Meu/Minha". When do I need to use the "O"/"A" before the "Meu"/"Minha"?
You can't say "meu trem" in Portuguese, even writers and important people in Brazil get to manage the language properly. "Meu trem" is quite informal, actually.
Meu (without the article) means "mine" NOT "my", so there's a direct translation into English, but "o meu" also works as a pronoun.
As Pauloenrique said, when it is a possessive, the name follows, so you can ommit, but you must use the article when it's a pronoun (in replacement of a substantive). The brasilians tend to ommit the pronoun. The portuguese use it more. Sometimes it doesn't make much of a difference. For example: pt-br) Deixei meu carro no acostamento pt-pt) Deixei o meu carro na berma It means "I left my car on the hard shoulder" (or "I left my car at the roadside") The use (or not) of the pronouns is perfectly understood by a brasilian or a portuguese (as for the word "acostamento" it is not used in Portugal and people will have difficulty understanding).
But there are some subtle differences (for both versions of portuguese). 1) Ela é minha amiga. 2) Ela é a minha amiga. On the first case it means that "she is a friend". On the second it means that she is a specific friend that you previously talked about. It could also suggest that this woman is the only friend that you have.
I’ve been studying for over 5 years now and I don’t understand what you wrote. It’s been very frustrating not being able to understand Portuguese even though I’ve been to Brasil 16 times and study every day with my girlfriend who only speaks Portuguese. It’s like deciphering a secret code. Thanks