This is a tough question for which there is not one specific answer.
Many pastors have friends in the church.
Many have friends only outside the church. If I share some intimate concern, it may be spread as gossip through the church even if I have asked the friend to keep the information totally confidential. These are real concerns because unfortunately gossip has been spread and trust has been broken in all of our lives at one time or another. Whatever the situation, there are some underlying challenges related to this question. This is a tragedy.