Who can claim a child if they lived with a friend (non-relative) for most of the year?

My son stayed with a friend most of last year. The parent did not have any legal rights to him and I am his only parent. Can I or the other person claim him?