Lets face it, we dont know, most of the time how to use correctly many of the most important structures of the Spanish Language.
# Visitaron al amigo de Juan, el cual había ayudado con la mudanza la última vez.
In this sentence: they visited Johns friend, who had helped with the move last time. In this case, ” el cual” is specifing which friend they visited among others, for that reason it can not be applied, is a specificative sentence.
You can say:
→ Visitaron al amigo que había ayudado con la mudanza el año pasado.
They visited the friend who had helped with the move last year.
In Spanish classes, I usually explain to students about the best option to apply this structure and I pass them this information: when you know that the information given is about to make a clear explanation says something about the thing or person mentioned, always preceeded by a coma.
→ Visitaron al amigo Pedro, el cual/el que los había ayudado con la mudanza el año pasado.
In english I often use which, that which to make clear that I dont want to repeat the concept or noun but Im still talking about it, in Spanish you do the same, specially when it refers to abstract ideas, concepts or mention what someone else said. But the main problem is that it will changes into femeinine sing and plural and into masculine sing and plural.
One fo the first rules to know how to use them correctly is to place them after a preposition.
Él es el amigo del cual te hablé. de+el=del (contraction)
Él es el amigo con el cual hablé.