Measuring definable sets in nonarchimedean o-minimal fields and an application to the reals