Alastair Cook and Nick Compton gave England hope on day four of the first Test at the University Oval.