President recalls shared colonial past on African visit