Thanks for posting that. I am going through issues with my dog and aggression right now. I have a behaviorist coming, and I needed to read your positive post.
We had similar issues with a dog years ago who was very sweet the first few months - a bit fearful of being in a new place, but sweet with us and our other dog. We really knew nothing about dogs back then, and unfortunately, we made the situation way worse. As her dominance and aggression escalated, we made her world smaller and smaller. In a couple years, she was totally neurotic and untrustworthy around people and animals outside our home.
This dog of ours saw that we were not Leaders, so she filled the vacuum - as any dog will in the same situation. She was "on duty" 24/7, and didn't even sleep well because she felt she had to defend her pack. I suspect your dog is doing the same thing. She saw your friend's daughter as some kind of threat to her pack, and gave her a warning shot to stop whatever behavior was unacceptable.
I strongly recommend you hire a veterinary behaviorist for a few sessions to teach you how to overcome these problems. It's just a matter of learning a few techniques to teach your dog her place in the pack - and it's NOT as top dog. LOL! Once you learn how to manage your dog, it's entirely possible to get the dog to see your young child as being "above" her in the pack order.
We have some new neighbors across the street who have 2 young girls who are afraid of dogs. Once I showed their father how to deal with dogs who come to have a sniff at his kids, he taught his girls. Now they actually like our dogs. It's just a matter of not yelling, using the right energy, and snapping your fingers at them. They WILL back off and sniff from afar.
Anyway, a behaviorist can help teach you how to manage your dog's behavior and have a happy, calm household. It shouldn't take long either. :-)