In a court of law, from the age of 10, a child's feelings/ desires are generally listened to and taken into consideration.
My own son at the age of 10 was causing a lot of trouble for me and the stress of this was affecting my health (MS), I asked socservs for advice and their solution was to hold a case conference which my (poisonous) mother managed to get involved in and said she wanted to take him away from me and raise him herself.
I was not a particularly young mum and there were no red flags associated with my parenting, in fact I also had a3yr old at the time. My 10yr old was asked whether he would like to live with his grandmother, he said yes and he's lived with her for the past 22yrs. My wishes as his mother/carer were totally disregarded. I did continue to raise my younger child like an only child and he's a very kind, considerate, loving young man of 25 now.
We did later discover that my elder son had some mh issues and no matter how much I fought to have him returned to me, it was always what 'he' wanted that the courts bowed down to, his brother's desire for them both to be together with me was never considered.
So, basically, if it suits the courts and social services to take a child's feelings into consideration, they will, if it doesn't suit them, then they won't.