Hierarchical clustering and the Butcher–Oemler effect