Is it appropriate to share the distribution of grades for a small class?
No, for exactly the reason you give. If just a couple students share their grades with each other, it becomes trivial for others to be discovered by process of elimination.
Check if the university has a policy on this. This varies wildly across locations: in some places grades are still published with the students' names next to them; in others there are stated policies that this is not allowed. At my university, histograms are automatically published by the system no matter the number of students (even if 2), and there is no way to prevent this.
If there is no policy on this, it is your choice how much you want to weigh transparency vs data protection. There are also intermediate options, such as only publishing the mean, maximum and minimum grade, or the mean amd variance.
I take issue with your premise:
It seems only fair to tell students how they did relative to the rest of the class
In a large class, this seems reasonable: if I know that I'm in the top 5%, I know that I am likely to get an A, regardless of my actual score. Even professors who "don't curve" usually adjust difficulty levels to achieve the desired outcome.
In a class with three students, this is not really the case -- giving three As or three Cs could be appropriate. Saying "you got the top score" doesn't really provide any information about my performance. So, I would argue that it provides no upside. Others have already covered the downside - namely, privacy violations.
I would suggest a better option would be to say: "Scores above 80 are A-range, 65 is B-range, 50 is C-range." This is both more useful to the student and sidesteps any privacy issue.