Overloading functions like Mean for distributions

Symbolic(!) distributions are recognized by their head, not by their PDF:

Mean[PDF[NormalDistribution[0, 1], x]] 

Mean[E^(-(x^2/2))/Sqrt[2 π]]

So instead of messing around with Mean, I would rather suggest

distro /: PDF[distro[μ_, σ_], x_] := E^(-((x - μ)^2/(2 σ^2)))/(Sqrt[2 π] σ);
distro /: Mean[distro[μ_, σ_]] := μ;
distro /: Variance[distro[μ_, σ_]] := σ^2
Mean[distro[0, 1]]
Variance[distro[0, 1]]

0

1


This works:

Unprotect[Mean];
SetAttributes[Mean, HoldFirst];
Protect[Mean];
f[x_] := 2 + x
f /: Mean[f[x_]] := 3 x

Since using Unprotect is not reccomended here's another way.

mean[x_] := Mean[x]
SetAttributes[mean, HoldFirst]
f[x_] := 2 + x
f /: mean[f[x_]] := 3 x